/**
 * Created with Intellij IDEA.
 * Description:
 * User:Lenovo
 * Date:2024-12-10
 * Time:12:57
 */
class Student implements Cloneable {
    private int age;
    private String name;

    public Student(int age, String name) {
        this.age = age;
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
    public Student clone()throws CloneNotSupportedException{
        return (Student) super.clone();
    }

    @Override
    public String toString() {
        return "Student{" +
                "age=" + age +
                ", name='" + name + '\'' +
                '}';
    }
}
public class Text {
    public static void main(String[] args) throws CloneNotSupportedException {
        Student student1 = new Student(18,"阿拉贡");
        Student student2 = student1.clone();
        Student student3 = student1;
        student1.setAge(20);
        System.out.println(student1);
        System.out.println(student2);
        System.out.println(student3);

    }
}
